package com.sort;


public class Sort_2 {
    public static void main(String[] args) {
        int arr[]={123,23,53,645,1234,765,34585,8556,234,232,856,9679,23867};
        B.sort(arr);
        for(int data:arr){
            System.out.print(data+" ");
        }



    }
}

class B{
    public static void sort(int[]arr){
        for(int i=1;i<arr.length;i++){
            int insertval=arr[i];
            int insertIndex=i-1;
            while(insertIndex>=0&&insertval<arr[insertIndex]){
                arr[insertIndex+1]=arr[insertIndex];
                insertIndex--;
            }
            arr[insertIndex+1]=insertval;
        }
    }
}
